from baseCommand import *

class _Msg(baseCommand):
	def __init__(self, msg, target="Console"):
		self.name = "Msg"
		self.msg = msg
		self.target = target

	def Msg(self, msg, target="Console", append=True):
		print "Msg", msg, "target", target, "append", append

		if append:
			self.commands.append(self._toStr(msg, target))
		else:
			return _Msg(msg, target)

	def _toStr(self, msg, target="Console"):
		return 'Msg(%s, "%s")' % (target, msg)

	def __str__(self):
		return self._toStr(self.msg, self.target)